<?php
/**
 * Created by PhpStorm.
 * User: s.utkin
 * Date: 14.08.14
 * Time: 15:35
 */

namespace Messenger;

use Pinenut\User\Profile;

class ChangerelationAction extends BaseAction
{
	protected static $isPublic = true;
	
	/**
	 * Указываем необходимые неявные параметры
	 * @return multitype:string
	 */
	static function pullParams() {
		return ['identity'];
	}
	
    /**
     * Меняет отношение пользователя к группе
     */
    protected function run()
    {
    	// отклюаем кеш
    	$this->response->noCache(true);
    	
        $targetProfileId = (string)$this->request->targetProfileId;
        $newRelationStatus = (int)$this->request->newRelationStatus;
        $myProfileId = $this->request->_identity;

		Groups::changeRelation($myProfileId, $targetProfileId, $newRelationStatus);

		$this->response->noRender(true);
    }
}